<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ihg-theme-draft">

  <%@ include file="/WEB-INF/include/header.jsp"%>
  <jsp:include page="/WEB-INF/include/submenu-session.jsp">
      <jsp:param name="currentUrl" value="${ctx.host}/sessions/${session.id}" />
  </jsp:include>

  <div class="container-fluid ihg-container has-ihg-sidemenu">

    <div class="ihg-breadcrumb">
      <ol class="breadcrumb border-breadcrumb">
        <li class="active">Scheduling Management</li>
      </ol>
      <div class="pull-right">
        <a href="${ctx.host}/active-sessions" style="color: #155CB2;"><<&nbsp;Go Back List</a>
      </div>
    </div>

    <div class="ihg-content-layout has-operation">
      <div class="row">
        <div class="col-xs-12">
          <ul class="nav nav-tabs" role="tablist" style="margin-top: 20px;">
            <li role="preparation"><a href="${ctx.host}/sessions/${session.id}/schedulings/relation">Relation</a></li>
            <li role="preparation" class="active"><a href="${ctx.host}/sessions/${session.id}/schedulings/schedule">Schedule</a></li>
          </ul>
          
          <div class="tab-content" style="margin-top: 25px;">

            <div class="col-xs-12 form-horizontal ihg-form" style="padding: 0px;">
              <div class="row schedule-wrap" id="schedule">
              
                <div id="view-schedule">
              
                  <div class="xls-wrap clearfix">
              
                    <div class="col-xs-12">
                      <c:choose>
                        <c:when test="${!task.status.finish}">
                          <div style="margin-top: 20px;" class="clearfix text-center">
                            <p style="margin-top: 10px; font-size:18px;" class="text-danger">The Schedule will be auto confirmed at 2018-12-23, click the button to confirm by yourself</p>
                            <a href="${ctx.host}/sessions/${session.id}/schedulings/schedule/confirm" data-target="#confirm-schedule" data-toggle="modal" class="btn btn-success btn-shadow btn-shadow-success x-btn" style="margin-top:20px;">CONFIRM</a>
                          </div>
                        </c:when>
                        
                        <c:otherwise>
                          <ul class="nav nav-tabs ihg-nav-tabs" role="tablist" style="margin-top: 20px;">
                            <li role="preparation" class="${subSession == 'A' ? 'active' : ''}"><a href="#sub-session-a" aria-controls="sub-session-a" role="tab" data-toggle="tab">Sub Session A</a></li>
                            <c:if test="${not empty subSessionB}">
                              <li role="preparation" class="${subSession == 'B' ? 'active' : ''}"><a href="#sub-session-b" aria-controls="sub-session-b" role="tab" data-toggle="tab">Sub Session B</a></li>
                            </c:if>
                          </ul>
                  
                          <div class="tab-content sub-session-nav" style="top: 25px; right: 20px;">
                            <div class="tab-pane ${subSession == 'A' ? 'active' : ''}" id="sub-session-a">
                              <ul class="nav nav-pills ihg-nav-pills" role="tablist" style="margin-bottom: 0px;">
                                <c:forEach var="group" items="${subSessionA}">
                                  <li role="preparation" class="${subGroup == group.key ? 'active' : ''}"><a href="${ctx.host}/sessions/${session.id}/schedulings/schedule?group=${group.key}">GROUP ${group.key}</a></li>
                                </c:forEach>
                              </ul>
                            </div>
                            <div class="tab-pane ${subSession == 'B' ? 'active' : ''}" id="sub-session-b">
                              <ul class="nav nav-pills ihg-nav-pills" role="tablist" style="margin-bottom: 0px;">
                                <c:forEach var="group" items="${subSessionB}">
                                  <li role="preparation" class="${subGroup == group.key ? 'active' : ''}"><a href="${ctx.host}/sessions/${session.id}/schedulings/schedule?group=${group.key}">GROUP ${group.key}</a></li>
                                </c:forEach>
                              </ul>
                            </div>
                          </div>
                          
                          <div class="tab-content">
                            <div class="tab-pane row active">
                              <%@ include file="/WEB-INF/include/submenu-session-group.jsp"%>
                            </div>
                          </div>
                        </c:otherwise>
                      </c:choose>
              
                    </div>
              
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/footer.jsp"%>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/session/preparation/session-scheduling-list.js" />
  <script type="text/javascript">
    require([ 'page/session/preparation/session-scheduling-list' ], function (
        page ) {
      page.init();
    })
  </script>
  
</body>
</html>
